{extend name="public:_single" /}
{block name="title"}节点编辑{/block}
{block name="description"}描述{/block}
{block name="keywords"}关键词{/block}
{block name="heading"}节点{/block}
{block name="breadcrumb"}节点 > 编辑{/block}
{block name="wrapper"}

<!-- Plugin stylesheets -->
<link href="/static/back/plugins/misc/qtip/jquery.qtip.css" rel="stylesheet" type="text/css" />
<link href="/static/back/plugins/forms/inputlimiter/jquery.inputlimiter.css" type="text/css" rel="stylesheet" />
<link href="/static/back/plugins/forms/togglebutton/toggle-buttons.css" type="text/css" rel="stylesheet" />
<link href="/static/back/plugins/forms/uniform/uniform.default.css" type="text/css" rel="stylesheet" />
<link href="/static/back/plugins/forms/color-picker/color-picker.css" type="text/css" rel="stylesheet" />
<link href="/static/back/plugins/forms/select/select2.css" type="text/css" rel="stylesheet" />
<link href="/static/back/plugins/forms/validate/validate.css" type="text/css" rel="stylesheet" />


<form action="javascript:void(0);" class="form-horizontal" id="form-node-edit" data-action="{:url('back/Node/editProcess')}" data-id="{$data.id}">
    <div class="form-group">
        <label class="col-lg-3 control-label" for="form-node">控制器/方法</label>
        <div class="col-lg-9">
            <input type="text" name="node" class="form-control uniform-input text" id="form-node" value="{$data.node}">
        </div>
    </div>

    <div class="form-group">
        <label class="col-lg-3 control-label" for="form-nodename">控制器/方法名</label>
        <div class="col-lg-9">
            <input type="text" name="nodename" class="form-control uniform-input text" id="form-nodename" value="{$data.nodename}">
        </div>
    </div>

    <div class="form-group">
        <label class="col-lg-3 control-label" for="form-pid">父节点</label>
        <div class="col-lg-9">
            <select name="pid" id="form-pid">
                <option value="0">顶级节点</option>
                {volist name="nodes" id="vo"}
                <option value="{$vo.id}" {$vo.id==$data.pid?'selected':'';} {$vo.id==$data.id?'disabled':'';}>{$vo._name}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="form-group">
        <label class="col-lg-3 control-label" for="form-sort_number">排序</label>
        <div class="col-lg-9">
            <input type="text" name="sort_number" class="form-control uniform-input text" id="form-sort_number" value="{$data.sort_number}">
        </div>
    </div>

    <div class="form-group">
        <label class="col-lg-3 control-label" for="form-remark">备注</label>
        <div class="col-lg-9 ">
            <textarea name="remark" id="form-remark" class="form-control">{$data.remark}</textarea>
        </div>
    </div>

    <div class="form-group">
        <div class="col-lg-offset-3 col-lg-9">
            <button type="submit" class="btn btn-info">保存</button>
        </div>
    </div>

</form>
{/block}

{block name="plugins_js"}

<!-- Form plugins -->

<script type="text/javascript" src="/static/back/plugins/forms/elastic/jquery.elastic.js"></script>
<script type="text/javascript" src="/static/back/plugins/forms/inputlimiter/jquery.inputlimiter.1.3.min.js"></script>
<script type="text/javascript" src="/static/back/plugins/forms/maskedinput/jquery.maskedinput-1.3.min.js"></script>
<script type="text/javascript" src="/static/back/plugins/forms/togglebutton/jquery.toggle.buttons.js"></script>
<script type="text/javascript" src="/static/back/plugins/forms/uniform/jquery.uniform.min.js"></script>
<script type="text/javascript" src="/static/back/plugins/forms/globalize/globalize.js"></script>
<script type="text/javascript" src="/static/back/plugins/forms/color-picker/colorpicker.js"></script>
<script type="text/javascript" src="/static/back/plugins/forms/timeentry/jquery.timeentry.min.js"></script>
<script type="text/javascript" src="/static/back/plugins/forms/select/select2.min.js"></script>
<script type="text/javascript" src="/static/back/plugins/forms/dualselect/jquery.dualListBox-1.3.min.js"></script>
<script type="text/javascript" src="/static/back/plugins/forms/tiny_mce/tinymce.min.js"></script>
<script type="text/javascript" src="/static/back/js/supr-theme/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="/static/back/js/supr-theme/jquery-ui-sliderAccess.js"></script>
<script type="text/javascript" src="/static/back/plugins/forms/validate/jquery.validate.js"></script>
<script type="text/javascript" src="/static/back/plugins/forms/wizard/jquery.form.js"></script>

<!-- Init plugins -->

<script type="text/javascript" src="/static/back/js/forms.js"></script><!-- Init plugins only for page -->

<script>
    $("#form-node-edit").validate({
        rules:{
            name: {
                required: true,
                minlength: 2
            }
        },
        onkeyup:false,
        focusCleanup:true,
        success:"valid",
        submitHandler:function(form){
            $(form).ajaxSubmit({
                type:'post',
                url: $(form).data('action'),
                dataType: 'json',
                data:{
                    id:$(form).data('id')
                },
                success:function(response){
                    if (response.status == 'success') {
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.msg('编辑成功，id='+response.result.id,{icon:1,time:10000});
                        setTimeout(function(){
                            parent.location.reload(); // 刷新页面
                            parent.layer.close(index);
                        },1200);
                    } else if ( response.status == 'failed') {
                        parent.layer.msg('编辑失败，code='+response.code,{icon:2,time:1000});
                    }
                },error:function(data) {
                    parent.layer.msg('无效的请求',{icon:2,time:1000});
                }
            });
        }
    });
</script>
{/block}

